package com.spring.reactive.program.controller;

import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.HandlerFunction;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * @Author: TongRui乀
 * @Date: 2021/4/10 15:23
 * @description：  接口的处理逻辑
 */
@Component
public class UserServiceHandler implements HandlerFunction<ServerResponse> {


    @Override
    public Mono<ServerResponse> handle(ServerRequest serverRequest) {

        System.out.println(serverRequest.bodyToMono(String.class));

        return ServerResponse.ok().body(Mono.just("success"), String.class);
    }
}
